home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1984 October
/
1984-10.d64
/
quiz master
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
6KB
|
218 lines
10 rem quiz master
20 dimq$(100),a$(100),b$(100),c$(100),d$(100),e$(100),m$(15)
30 print"":poke53280,13:poke53281,5:goto50
40 poke198,6:poke631,30:poke632,34:poke633,34:poke634,20:poke635,5:return
50 poke53272,23:goto970
60 print"[147]":clr
70 dimq$(100),a$(100),b$(100),c$(100),d$(100),e$(100),m$(15),sn$(400),g(400)
80 gosub1830:gosub1360:gosub2070
90 print"[197]nter number of test to load:":inputn
100 ifn<0orn>xthenprint"[201]nvalid [210]ange":goto90
110 n$=m$(n):printspc(12)"[147] [204][207][193][196][201][206][199][160][196][193][212][193][160][160][160]"
120 gosub1830:gosub2150:open2,8,2,+n$+" file,s,r":x=0
130 x=x+1
140 input#2,q$(x):input#2,a$(x):input#2,b$(x):input#2,c$(x):input#2,d$(x):input#2,e$(x)
150 ifst and64then170
160 goto130
170 close2:poke198,0:l=x:n=x:t=0
180 ifr=1then240
190 gosub2150:gosub2070:gosub1670
200 ifh=0then970
210 ifh=1then240
220 rem input questions
230 print"[147][197]nter [206]ame for [209]uiz":inputn$:gosub1460:n=0
240 n=n+1:print"[147]":printspc(13)" [209][213][201][218] [205][193][211][212][197][210] [146]"
250 print:print" [215][193][210][206][201][206][199]! [196]o not exceed 80 [195]haracters "
260 print:print" [197]nter \ to exit routine "
270 ifn>=100thenprint"[147] [198][201][204][197][160][198][213][204][204]":fort=1to2000:next:goto980
280 gosub40
290 h=0
300 print"[197]nter [209]uestion #";n:print
310 inputq$(n)
320 ifq$(n)=""then310
330 ifq$(n)=chr$(92)thenn=n-1:goto770
340 iflen(q$(n))>80thengosub1290
350 ifh=1then240
360 print"[197]nter first answer:":print:gosub40:h=0
370 input"a. ";a$(n):ifa$(n)=""then370
380 ifasc(a$(n))=92thenn=n-1:goto770
390 a$(n)="a. "+a$(n)
400 iflen(a$(n))>80thengosub1290
410 ifh=1thengoto360
420 print"[197]nter second answer:":print:gosub40:h=0
430 input"b. ";b$(n):ifb$(n)=""then430
440 ifasc(b$(n))=92thenn=n-1:goto770
450 b$(n)="b. "+b$(n)
460 iflen(b$(n))>80thengosub1290
470 ifh=1thengoto420
480 print"[197]nter third answer:":print:gosub40:h=0
490 input"c. ";c$(n):ifc$(n)=""then490
500 ifasc(c$(n))=92thenn=n-1:goto770
510 c$(n)="c. "+c$(n)
520 iflen(c$(n))>80thengosub1290
530 ifh=1thengoto480
540 print"[197]nter fourth answer:":print:gosub40:h=0
550 input"d. ";d$(n):ifd$(n)=""then550
560 ifasc(d$(n))=92thenn=n-1:goto770
570 d$(n)="d. "+d$(n)
580 iflen(d$(n))>80thengosub1290
590 ifh=1thengoto540
600 print"[197]nter [204]etter of [195]orrect [193]nswer:":print:h=0
610 inpute$(n):ife$(n)=""then610
620 ifasc(e$(n))=92thenn=n-1:gosub770:goto990
630 iflen(e$(n))<>1thengosub1290
640 ife$(n)="a"then690
650 ife$(n)="b"then690
660 ife$(n)="c"then690
670 ife$(n)="d"then690
680 print" [197]rror: re-enter":goto610
690 ifh=1then600
700 ifp=1thenreturn
710 l=n:gosub2070:ifn=100then730
720 goto240
730 print:printspc(7)"[198]ile contains 100 [197]ntries."
740 print:print"[196]ata will be stored. [207]pen new text file"
750 gosub1720:gosub770:goto990
760 rem store data
770 gosub2070:printspc(10)" [215]ait, [211]toring [196]ata ":gosub2150
780 gosub1830:open2,8,2,"@0:"+n$+" file,s,w"
790 forx=1tol:print#2,q$(x):print#2,a$(x):print#2,b$(x):print#2,c$(x):print#2,d$(x):print#2,e$(x):next
800 close2:poke198,0:gosub2150:gosub2070:gosub1670:return
810 rem change answer
820 gosub2070:p=1:print"[147] [197]nter [206]umber of [209]uestion":inputw
830 print"[147]":s$=q$(w):gosub1190:s$=a$(w):gosub1190:s$=b$(w):gosub1190
840 s$=c$(w):gosub1190:s$=d$(w):gosub1190
850 print"[195]orrect answer is:":printe$(w)
860 gosub1670:n=w-1:gosub240:gosub770:return
870 rem review routine
880 gosub2070:y=1:print"[147]"
890 print:printtab(20-len(n$)/2);n$:gosub1670:print""
900 forn=1tol:print"[147]"
910 ifq$(n)=""thengoto960
920 s$=str$(n)+". "+q$(n):print:gosub1190
930 rem answer choices
940 s$=a$(n):gosub1190:s$=b$(n):gosub1190:s$=c$(n):gosub1190:s$=d$(n):gosub1190
950 print:print"[195]orrect answer is: ":printtab(7)e$(n):gosub2070
960 gosub1670:next:return
970 rem program menu
980 h=0
990 print"[147]":poke53280,13:poke53281,5
1000 gosub2070
1010 p=0
1020 printspc(13)" [209][213][201][218][160][205][193][211][212][197][210] "
1030 print:printspc(5)"[197]nter number of function:"
1040 print:printspc(8)"1. [197]nter [206]ew [209]uestions"
1050 print:printspc(8)"2. [210]eview [209]uestions"
1060 print:printspc(8)"3. [195]hange a [209]uestion"
1070 print:printspc(8)"4. [204]oad [208]revious [196]ata"
1080 print:printspc(8)"5. [193]dd to [212]est in [198]ile"
1090 print:printspc(8)"6. [201][206][201][212][201][193][204][201][218][197] [196]isk"
1100 print:printspc(8)"7. [197][206][196]"
1110 print:printspc(5)"[206]umber?"
1120 getg$:ifg$=""then1120
1130 g=asc(g$)-48:ifg<1org>8then1120
1140 onggosub230,880,820,60,1640,1730,1170
1150 goto990
1160 gosub2070
1170 poke198,0:sys198
1180 rem print justify
1190 print
1200 iflen(s$)<40thenprints$:goto1280
1210 x=40:y=1
1220 x=x-1
1230 ifasc(mid$(s$,x,y)+chr$(0))<>32then1220
1240 printleft$(s$,x)
1250 z=len(s$)
1260 z=z-x
1270 printright$(s$,z)
1280 return
1290 print"entry too long: re-phrase"
1300 h=1:fort=1to2000:next:return
1310 rem test title file
1320 print:print"has test title file been initiated?(y/n)":gosub2070
1330 getg$:ifg$=""then1330
1340 if g$="n"then1460
1350 ifg$<>"y"then1330
1360 print:printspc(17)" wait "
1370 gosub2150:gosub1830:open3,8,3,"test titles,s,r"
1380 x=0
1390 x=x+1:input#3,m$(x)
1400 ifst and64then1420
1410 goto1390
1420 close3:poke198,0:gosub2150
1430 ifs1<>0then2110
1440 print"[147]":printspc(14)"test titles":print
1450 fora=1tox:printa;". ";m$(a):next:return
1460 rem initiate test file
1470 ifx=15thengosub1710
1480 if x=15thenx=1
1490 ifx=1then1600
1500 print"[147][200]as file of test names been started?"
1510 getg$:ifg$=""then1510
1520 if g$="n"then1600
1530 ifg$="y"thengosub1370
1540 printx+1". "n$
1550 print"[201]s your title original?"
1560 getg$:ifg$=""then1560
1570 if g$="y"then1600
1580 print"[197]nter new title for test:"
1590 inputn$
1600 m$(x+1)=n$:gosub2070
1610 print:printspc(13)" [211]aving [212]itle "
1620 gosub1830:open3,8,3,"@0:test titles,s,w"
1630 fora=1tox+1:print#3,m$(a):next:close3:poke198,0:gosub2150:return
1640 rem test addition routine
1650 clr
1660 r=1:gosub70:r=0:goto990
1670 print:printtab(5)" [208][210][197][211][211][160][211][208][193][195][197][160][194][193][210][160][212][207][160][195][207][206][212][201][206][213][197] [146]"
1680 getg$:ifasc(g$+chr$(0))<>32then1680
1690 return
1700 print"[147]"
1710 printspc(10)"[147][198][201][204][197] [198][213][204][204]"
1720 fort=1to2000:next:return
1730 print"[147] [196]o you want to initialize a new disk? ":printtab(17)" ([217]/[206]) "
1740 getg$:ifg$=""then1740
1750 ifg$="y"thenprint"type [199][207][212][207] 1790 and press [210][197][212][213][210][206]":end
1760 ifg$<>"n"then1740
1770 ifg$="n"thenreturn
1780 end
1790 print"[147] [201]nsert [206]ew [196]isk into [196]rive
1800 [153]" (NULL)ress any key when ready to proceed"
1810 [141]1820:[137]1850
1820 [161]g$:[139]g$[178]""[167]1820
1830 [159]15,8,15:[152]15,"i0:":[160]15:[142]
1840 [128]
1850 [143] print"load (NULL)atnright$(NULL)1730
1860 print" [215][193][210][206][201][206][199]!!!"
1870 print" [196][201][211][203][160][201][206][160][196][210][201][214][197][160][201][211][160][193][194][207][213][212][160][212][207][160][194][197][160][197][210][193][211][197][196]!"
1880 print" [160] [160][193][210][197][160][217][207][213][160][211][213][210][197]? ([217]/[206]) "
1890 getg$:ifg$=""then1890
1900 ifg$="y"then1930
1910 ifg$="n"then990
1920 goto1890
1930 print"[147][197]nter [196][201][211][203][206][193][205][197]";:inputdn$
1940 iflen(dn$)>15thenprint"[206][193][205][197][160][212][207][207][160][204][207][206][199], [212][210][217][160][193][199][193][201][206]":fort=1to1000:next:goto1930
1950 print"[197]nter 2 [195]haracter disk [201].[196].":inputid$
1960 poke53281,2:poke53280,2:print"[147] [204][193][211][212][160][195][200][193][206][195][197][160][212][207][160][211][212][207][208]!!!"
1970 print:print" [208][210][197][211][211][160][193][206][217][160][203][197][217][160][212][207][160][211][212][207][20